/* 当导入的模块名字过长或者过于复杂,可以使用as语句给其设置一个别名 */
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
import Home from '../views/Home'
import Music from '../views/Music'
import Detail from '../views/Detail'
const routes = [
    {
        path: "/",
        element: <Home />
    }, {
        path: "/music",
        element: <Music />
    }, {
        path: "/detail",
        element: <Detail />
    }
]
function RouterView() {
    return (
        <Router>
            <Routes>
                {routes.map(item => {
                    return (<Route key={item.path} path={item.path} element={item.element}></Route>)
                })}
            </Routes>
        </Router>
    )
}
export default RouterView;
